home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
2207
/
2207.xpi
/
chrome
/
cooliris.jar
/
content
/
cooliris
/
coolirisPagePreviews.js
< prev
next >
Wrap
Text File
|
2010-01-28
|
27KB
|
1,032 lines
var cpvw_iconDelayController={linkViewCount:0,maxDelay:2000,increment:100,thresholdCount:15,reset:function(){
var _1=cpvw_objOverlay.getContentDocument();
_1.iconDelayTime=null;
this.linkViewCount=0;
},increaseDelay:function(){
var _2=cpvw_objOverlay.getContentDocument();
if(!_2){
return;
}
if(!_2.iconDelayTime){
_2.iconDelayTime=parseInt(cpvw_prefHandler.getPref(cpvw_Prefs.prefMouseIconDelay),10);
this.linkViewCount=0;
}
this.linkViewCount++;
if(this.linkViewCount>this.thresholdCount){
if(_2.iconDelayTime<this.maxDelay){
_2.iconDelayTime+=this.increment;
}
}
},getIconDelayTime:function(){
var _3=cpvw_objOverlay.getContentDocument();
if(_3&&_3.iconDelayTime){
return _3.iconDelayTime;
}
return cpvw_prefHandler.getPref(cpvw_Prefs.prefMouseIconDelay);
}};
function cpvw_clsPreview(_4){
this.parentDoc=_4;
this.popTimer=null;
this.linkUrl="";
this.pageX=0;
this.pageY=0;
this.openDelayTime=cpvw_Delays.OPEN_DELAY_TIME;
this.closeDelayTime=0;
this.isShowingPreview=false;
this.isShowingSmallDiv=false;
this.dimPreview=null;
this.prefetchIndex=0;
this.prefetchTimer=null;
this.prefetchDelay=cpvw_Delays.PREFETCH_DELAY_TIME;
this.hideTimer=null;
this.dispDelayTime=cpvw_Delays.DISPLAY_DELAY_TIME;
this.dispTimer=null;
this.doneHighlight=false;
this.highlightTimer=null;
this.smallDivTimer=null;
this.showSmallDivTimer=null;
this.newHistory=null;
this.aIndex=0;
this.prefetchIndex=0;
this.prefetchLinks=[];
cpvw_previewHandler.customSite="";
this.hText="";
this.linkElem=null;
this.pushpin=false;
this.enablePreview=true;
this.curIndex=0;
this.arrLinks=null;
this.evt=null;
this.mouseoverIconTimer=null;
}
cpvw_clsPreview.prototype={setup:function(){
var _5=cpvw_previewHandler.getPreviewFrame();
_5.addEventListener("DOMContentLoaded",cpvw_previewHandler,false);
_5.addEventListener("CoolPreviewsCoolirisDontShow",cpvw_previewHandler,false,true);
_5.addEventListener("CoolPreviewsCoolirisContinue",cpvw_previewHandler,false,true);
},clearTimer:function(_6){
if(_6==this.popTimer){
clearTimeout(this.popTimer);
this.popTimer=null;
}else{
if(_6==this.hideTimer){
clearTimeout(this.hideTimer);
this.hideTimer=null;
}else{
if(_6==this.dispTimer){
clearTimeout(this.dispTimer);
this.dispTimer=null;
}else{
if(_6==this.smallDivTimer){
clearTimeout(this.smallDivTimer);
this.smallDivTimer=null;
}else{
if(_6==this.showSmallDivTimer){
clearTimeout(this.showSmallDivTimer);
this.showSmallDivTimer=null;
}else{
clearTimeout(_6);
}
}
}
}
}
},startPrefetch:function(){
var _7=this.parentDoc.location.href;
var _8=Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
_8.spec=_7;
var _9=this;
for(var i=0;i<this.prefetchLinks.length;i++){
var _b=this.prefetchLinks[i];
var _c=Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
_c.spec=_b;
var _d=Components.classes["@mozilla.org/prefetch-service;1"].createInstance(Components.interfaces.nsIPrefetchService);
try{
_d.prefetchURI(_c,_8,true);
}
catch(ex){
}
}
},afterPrefetch:function(_e){
if(this.prefetchTimer){
clearTimeout(this.prefetchTimer);
}
this.prefetchIndex++;
if(this.prefetchIndex>=this.prefetchLinks.length){
var _f=document.getElementById("frmPrefetch");
if(_f!=null){
document.getElementById("main-window").removeChild(_f);
}
return;
}
this.startPrefetch();
},convertLinks:function(){
var doc=this.parentDoc;
this.prefetchLinks=[];
this.arrLinks=[];
var _11=this.parentDoc.getElementsByTagName("a");
doc.addEventListener("DOMNodeInserted",function(evt){
var _13=evt.target;
var _14;
if(_13 instanceof HTMLLinkElement){
_14=[];
_14.push(_13);
cpvw_docHandler.modifyLinks(_14);
}else{
if(_13.getElementsByTagName){
_14=_13.getElementsByTagName("a");
cpvw_docHandler.modifyLinks(_14);
}
}
},false);
this.modifyLinks(_11);
},modifyLinks:function(_15){
var _16=this;
var _17=[];
var _18=[];
var _19=false;
for(var i=0;i<navigator.mimeTypes.length;i++){
if(navigator.mimeTypes[i].type.toLowerCase()=="application/pdf"){
_19=true;
}
}
for(i=0;i<_15.length;i++){
if(_15[i].href.toString().indexOf("http")==-1||_15[i].href.toString().indexOf("#")==_15[i].href.toString().length-1||_15[i].href.toString().toLowerCase().indexOf("logout")!=-1||_15[i].href.toString().toLowerCase().indexOf("signin")!=-1||_15[i].href.toString().toLowerCase().indexOf("login")!=-1||_15[i].href.toString().toLowerCase().indexOf("signout")!=-1){
continue;
}
if(cpvw_previewHandler.customSite=="google_search"){
var _1b=_15[i].href.toString().indexOf("/",8);
if(_15[i].href.toString().indexOf("/webhp")!=-1){
continue;
}
}
if(cpvw_previewHandler.customSite=="technorati"){
if(_15[i].href.toString().indexOf("www.technorati.com/search")!=-1||_15[i].href.toString().indexOf("www.technorati.com/faves")!=-1){
continue;
}
}
if(cpvw_previewHandler.customSite=="delicious"){
if(_15[i].href.toString().indexOf("delete=")!=-1){
continue;
}
}
var _1c=""+_15[i].href;
if(_1c.match(/\.(pdf)$/i)){
if(!_19){
continue;
}
}
if(_15[i].getAttribute("set")=="yes"){
continue;
}
_15[i].setAttribute("linkIndex",this.arrLinks.length);
_15[i].addEventListener("mouseover",function(evt){
var _1e=this;
cpvw_docHandler.curIndex=parseInt(this.getAttribute("linkIndex"));
cpvw_docHandler.evt=evt;
_16.previewOpen(evt,this.href,this);
},true);
_15[i].addEventListener("mouseout",function(evt){
var _20=this;
_16.previewClose(evt);
},false);
_15[i].addEventListener("click",function(evt){
var _22=this.href.toString();
if(cpvw_previewHandler.previewOpenMode=="click"&&(!cpvw_docHandler.isShowingPreview||cpvw_docHandler.linkUrl!=_22)){
cpvw_docHandler.openDelayTime=0;
cpvw_docHandler.dispDelayTime=500;
cpvw_docHandler.initPreviewShow(evt,this.href,this);
evt.preventDefault();
}else{
_16.initPreviewHide(evt);
cpvw_previewHandler.hidePreview();
}
},false);
if(_1c.match(/\.(pdf|doc|xls|ppt)$/i)){
continue;
}
this.arrLinks.push(_15[i].getAttribute("href"));
if(_15[i].id==""){
_18.push(_15[i]);
}else{
_17.push(_15[i]);
}
}
this.prefetchLinks=this.prefetchLinks.concat(_18,_17);
},getCurrentIndex:function(url){
var _24=-1;
for(var i=0;i<this.arrLinks.length;i++){
var _26=this.arrLinks[i];
if(cpvw_previewHandler.customSite=="google_search"){
if(_26==url){
return i;
}
}else{
if(cpvw_previewHandler.customSite=="yahoo_search"){
url=url.replace(":","%3a");
if(_26.indexOf(url)!=-1){
return i;
}
}
}
}
return _24;
},findNextGoogleLink:function(){
var _27=cpvw_previewHandler.getPreviewFrame();
var _28=_27.contentDocument;
var _29=this.getCurrentIndex(_28.URL);
var _2a=(_29==-1)?cpvw_docHandler.curIndex:_29;
for(var i=_2a+1;i<this.arrLinks.length;i++){
var _2c=this.arrLinks[i];
if(_2c==null){
continue;
}
var uri=Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
uri.spec=_2c;
if(cpvw_previewHandler.customSite=="google_search"){
if(uri.host.indexOf("google")!=-1||(_2c.indexOf("/search")!=-1||_2c.indexOf("q=cache")!=-1)){
continue;
}else{
break;
}
}else{
if(cpvw_previewHandler.customSite=="yahoo_search"){
if(_2c.indexOf("cache.search")!=-1){
continue;
}else{
break;
}
}
}
}
return i;
},displayNextLink:function(){
if(this.arrLinks.length==0){
return;
}
var _2e="";
if(cpvw_previewHandler.customSite!="google_search"&&cpvw_previewHandler.customSite!="yahoo_search"){
cpvw_docHandler.curIndex++;
}else{
cpvw_docHandler.curIndex=this.findNextGoogleLink();
}
if(cpvw_docHandler.curIndex>this.arrLinks.length){
cpvw_docHandler.curIndex=0;
}
_2e=this.arrLinks[cpvw_docHandler.curIndex];
if(cpvw_previewHandler.customSite=="google_search"){
if(_2e.charAt(0)=="/"){
_2e="http://www.google.com"+_2e;
}
}
this.popTimer=setTimeout(function(){
cpvw_docHandler.showPreview(_2e);
},10);
},handleKeyPress:function(evt){
if(evt.keyCode==32){
cpvw_docHandler.openDelayTime=cpvw_Delays.OPEN_DELAY_TIME;
cpvw_docHandler.dispDelayTime=cpvw_Delays.DISPLAY_DELAY_TIME;
cpvw_docHandler.initPreviewShow(evt,href,elem);
}
},previewClose:function(evt){
var _31=this;
if(cpvw_previewHandler.previewOpenMode=="direct"){
_31.initPreviewHide(evt);
}else{
if(cpvw_previewHandler.previewOpenMode=="icon"){
_31.clearTimer(_31.showSmallDivTimer);
if(!_31.smallDivTimer){
_31.smallDivTimer=setTimeout(function(){
_31.removeSmallDiv();
},2000);
}
if(_31.isShowingPreview){
_31.initPreviewHide(evt);
}
}else{
if(cpvw_previewHandler.previewOpenMode=="click"){
_31.clearTimer(_31.popTimer);
_31.clearTimer(_31.dispTimer);
}else{
if(cpvw_previewHandler.previewOpenMode=="hotkey"&&evt.ctrlKey){
_31.initPreviewHide(evt);
}
}
}
}
},previewOpen:function(evt,_33,_34){
var _35=this;
if(!_35.parentDoc.enablePreview){
return;
}
if(cpvw_previewHandler.previewOpenMode=="direct"){
_35.openDelayTime=cpvw_Delays.OPEN_DELAY_TIME;
_35.dispDelayTime=cpvw_Delays.DISPLAY_DELAY_TIME;
_35.initPreviewShow(evt,_33,_34);
}else{
if(cpvw_previewHandler.previewOpenMode=="icon"||cpvw_previewHandler.previewOpenMode=="icon-click"){
_35.openDelayTime=500;
_35.dispDelayTime=500;
_35.clearTimer(_35.smallDivTimer);
cpvw_iconDelayController.increaseDelay();
if(_35.isShowingPreview){
_35.initPreviewShow(evt,_33,_34);
}else{
_35.showSmallDivTimer=setTimeout(function(){
_35.showSmallDiv(evt,_33,_34);
},cpvw_iconDelayController.getIconDelayTime());
}
}else{
if(cpvw_previewHandler.previewOpenMode=="click"){
_35.clearTimer(_35.hideTimer);
}else{
if(cpvw_previewHandler.previewOpenMode=="hotkey"&&evt.ctrlKey){
_35.openDelayTime=100;
_35.dispDelayTime=500;
_35.initPreviewShow(evt,_33,_34);
}
}
}
}
},getElementPosition:function(_36){
var _37=0;
var _38=0;
if(_36){
var _39=_36.offsetParent;
if(_39){
while((_39=_36.offsetParent)!=null){
_37+=_36.offsetLeft;
_38+=_36.offsetTop;
_36=_39;
}
}else{
_37=_36.offsetLeft;
_38=_36.offsetTop;
}
}
return {"px":_37,"py":_38};
},getIconPosition:function(_3a){
var _3b=this.parentDoc.createElement("span");
_3b.setAttribute("id","cpvw_temporaryElement");
_3b.innerHTML=" adfd";
if(_3a.nodeType==1){
_3a.parentNode.insertBefore(_3b,_3a.nextSibling);
var _3c=_3b.offsetLeft;
var _3d=_3b.offsetTop;
if(_3b.offsetParent){
var _3e=_3b;
while(_3e.offsetParent){
_3c+=_3e.offsetParent.offsetLeft;
_3d+=_3e.offsetParent.offsetTop;
_3e=_3e.offsetParent;
}
}
_3a.parentNode.removeChild(_3b);
}else{
if(_3a.nodeType==3){
var _3f=_3a.splitText(endOffset);
_3a.parentNode.insertBefore(_3b,_3f);
_3c=_3b.offsetLeft;
_3d=_3b.offsetTop;
if(_3b.offsetParent){
var _3e=_3b;
while(_3e.offsetParent){
_3c+=_3e.offsetParent.offsetLeft;
_3d+=_3e.offsetParent.offsetTop;
_3e=_3e.offsetParent;
}
}
_3a.parentNode.removeChild(_3b);
}
}
return {"px":_3c,"py":_3d};
},showSmallDiv:function(evt,_41,_42){
if(this==cpvw_docHandler){
evt=cpvw_docHandler.evt;
}
var _43=this;
if(!_43.parentDoc.enablePreview){
return;
}
var pos=_43.getElementPosition(_42);
var px,py,_47=40;
var _48;
if(cpvw_prefHandler.getPref(cpvw_Prefs.prefFixedIcon)){
var _49;
if(!cpvw_jsUtils.isFF2()){
var _4a=_42.getClientRects();
var _4b=_4a.length;
var _4c=_42.ownerDocument.defaultView.pageYOffset;
var _4d=_42.ownerDocument.defaultView.pageXOffset;
for(var k=0;k<_4b;k++){
_48=_4a[k];
if(evt.pageY<_4c+_4a[k].bottom){
break;
}
}
pos.py=_4c+_48.bottom-16;
_49=_48.right;
}else{
if((pos.px+_42.offsetWidth)>_42.ownerDocument.defaultView.innerWidth){
var _4f=_43.getIconPosition(_42);
_49=_4f.px;
pos.py=_4f.py;
}else{
_49=pos.px+_42.offsetWidth+5;
}
}
px=_49+10;
}else{
if(!cpvw_jsUtils.isFF2()){
var _4a=_42.getClientRects();
var _4b=_4a.length;
var _4c=_42.ownerDocument.defaultView.pageYOffset;
var _4d=_42.ownerDocument.defaultView.pageXOffset;
for(var k=0;k<_4b;k++){
_48=_4a[k];
if(evt.pageY<_4c+_4a[k].bottom){
break;
}
}
pos.py=_4c+_48.bottom-16;
if(evt.pageX-_47<(_4d+_48.left)){
if(evt.pageX+20>(_4d+_48.right)){
px=_4d+_48.right;
}else{
px=evt.pageX+_47+20;
}
}else{
px=evt.pageX-_47-20;
}
}else{
if(_42.offsetWidth+_42.offsetLeft>_42.ownerDocument.defaultView.innerWidth){
px=pos.px-20;
pos.py=evt.pageY;
}else{
if(evt.screenX-_47<pos.px){
if(evt.screenX+_47+20>pos.px+_42.offsetWidth){
px=pos.px+_42.offsetWidth;
}else{
px=evt.screenX+_47+20;
}
}else{
px=evt.screenX-_47-20;
}
}
}
}
pos.px=px;
if(_43.curLink==_42){
return;
}
_43.removeSmallDiv(true);
if(!_43.isShowingPreview&&!_43.isShowingSmallDiv){
var _50=_43.parentDoc.createElement("img");
_50.setAttribute("src","chrome://cooliris/skin/new/mouseover.png");
_50.setAttribute("id","cpvw_smallDivTip");
_50.setAttribute("style","z-index:2147483647;border: 0px solid blue;-moz-opacity:0.20;position:absolute;width:20px;height:20px;");
var _51=function(){
_50.style.opacity=parseFloat(_50.style.opacity)+0.2;
if(parseFloat(_50.style.opacity)<0.9){
setTimeout(_51,75);
}
};
setTimeout(_51,50);
_50.style.left=pos.px+"px";
_50.style.top=pos.py+"px";
_43.parentDoc.body.appendChild(_50);
_43.isShowingSmallDiv=true;
_43.curLink=_42;
_50.addEventListener("mouseover",function(evt){
if(cpvw_previewHandler.previewOpenMode=="icon-click"){
return;
}
_43.clearTimer(_43.smallDivTimer);
clearTimeout(_43.smallDivRemoveTimer);
_50.style.opacity=0.9;
_43.mouseX=evt.screenX;
_43.mouseY=evt.screenY;
if(evt.altKey){
if(_41!=cpvw_stackManager.prevUrl){
cpvw_stackManager.addToStack(null,_41);
}
}else{
_43.mouseoverIconTimer=setTimeout(function(){
_43.initPreviewShow(evt,_41,_42);
},cpvw_Delays.PREVIEW_ON_ICON_DELAY);
}
},true);
_50.addEventListener("click",function(evt){
clearTimeout(_43.smallDivTimer);
clearTimeout(_43.smallDivRemoveTimer);
_50.style.opacity=0.9;
_43.mouseX=evt.screenX;
_43.mouseY=evt.screenY;
if(evt.altKey){
if(_41!=cpvw_stackManager.prevUrl){
cpvw_stackManager.addToStack(null,_41);
}
}else{
_43.initPreviewShow(evt,_41,_42);
}
},true);
_50.addEventListener("mouseout",function(evt){
clearTimeout(_43.mouseoverIconTimer);
_43.initPreviewHide(evt);
_43.removeSmallDiv();
},true);
_43.smallDivTimer=setTimeout(function(){
_43.removeSmallDiv();
},3000);
}else{
_43.initPreviewShow(evt,_41,_42);
}
},removeSmallDiv:function(_55){
var _56=this;
var _57=_56.parentDoc.getElementById("cpvw_smallDivTip");
if(_55){
_56.isShowingSmallDiv=false;
cpvw_docHandler.curLink=null;
if(cpvw_imageDocHandler){
cpvw_imageDocHandler.curLink=null;
}
if(_57!=null){
_56.parentDoc.body.removeChild(_57);
clearTimeout(_56.smallDivTimer);
}
}else{
if(_57!=null){
_57.style.opacity=parseFloat(_57.style.opacity)-0.1;
if(parseFloat(_57.style.opacity)>0){
_56.smallDivRemoveTimer=setTimeout(function(){
_56.removeSmallDiv();
},120);
}else{
_56.removeSmallDiv(true);
}
}
}
},initPreviewShow:function(evt,_59,_5a,_5b){
this.clearTimer(this.hideTimer);
var _5c=this;
cpvw_iconDelayController.reset();
var _5d=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewEnable);
if((_5d=="no"||!_5c.parentDoc.enablePreview)&&!_5b){
return;
}
conDump("gool search "+cpvw_previewHandler.customSite+", "+_59);
if(cpvw_previewHandler.customSite=="google_search"&&(_59.indexOf("http://www.google.com/pagead/iclk")!=-1||_59.indexOf("http://www.google.com/url")!=-1)){
var _5e=_59.split("&");
for(var i=0;i<_5e.length;i++){
if(_5e[i].indexOf("adurl=")!=-1){
_59=_5e[i].substr(6);
_59=unescape(_59);
}
}
}
if(cpvw_previewHandler.customSite=="yahoo_search"&&(_59.indexOf("overture.com")!=-1)){
var _60=_59.indexOf("yargs=");
if(_60!=-1){
_59=_59.substr(_60+6);
_59=unescape(_59);
if(_59.indexOf("http://")==-1&&_59.indexOf("https://")==-1){
_59="http://"+_59;
}
}
}
_5c.loadSubSearchBar();
this.pageX=evt.pageX;
this.pageY=evt.pageY;
this.screenX=evt.screenX;
this.screenY=evt.screenY;
if(this.linkUrl==_59&&this.isShowingPreview){
this.setPreviewDimensions();
return;
}
var _61=this.openDelayTime;
this.linkElem=_5a;
this.popTimer=setTimeout(function(){
_5c.showPreview(_59);
},_61);
var _62=this.dispDelayTime;
this.dispTimer=setTimeout(function(){
_5c.displayPreview();
},_62);
},loadSubSearchBar:function(){
var _63="";
if(cpvw_previewHandler.customSite=="google_search"){
var _64=this.parentDoc.getElementsByTagName("input");
for(var i=0;i<_64.length;i++){
if(_64[i].getAttribute("name")=="q"){
_63=_64[i].value;
break;
}
}
}else{
if(cpvw_previewHandler.customSite=="yahoo_search"){
var _64=this.parentDoc.getElementsByTagName("input");
for(var i=0;i<_64.length;i++){
if(_64[i].getAttribute("name")=="p"){
_63=_64[i].value;
break;
}
}
}
}
if(_63==""){
return;
}
cpvw_subSearchBar.selectedText=_63;
},initPreviewHide:function(evt){
var _67=this;
_67.clearTimer(this.popTimer);
_67.clearTimer(this.dispTimer);
this.clearTimer(this.showSmallDivTimer);
if(!_67.isShowingPreview){
return;
}
_67.hideTimer=setTimeout(function(){
_67.hidePreview(false);
},cpvw_Delays.CLOSE_DELAY_TIME);
},clearHideTimer:function(){
this.clearTimer(this.hideTimer);
},showPreview:function(_68){
conDump("IN SHOW PREVIEW HREF TIMER "+_68+", "+this.popTimer);
if(this.popTimer==null){
return;
}
var _69,_6a;
this.linkUrl=_68;
var _6b=this;
this.setPreviewDimensions();
_6a=cpvw_previewHandler.getPreviewFrame();
_69=cpvw_previewHandler.getPreviewWindow();
cpvw_previewHandler.isContextMenu=false;
if(!cpvw_jsUtils.isFF2()){
_6a.loadURI(this.linkUrl);
}else{
_6a.setAttribute("src",this.linkUrl);
}
cpvw_previewHandler.isLoaded=false;
if(cpvw_previewHandler.previewOpenMode!="click"){
this.parentDoc.addEventListener("click",cpvw_previewHandler.hidePreview,true);
}
},setPreviewDimensions:function(){
var doc=this.parentDoc;
var _6d=document.getElementById("appcontent").boxObject.y+30;
var _6e=this.screenX,_6f=this.screenY;
this.dimPreview=new cpvw_previewSize();
this.dimPreview.top=_6d;
var _70=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewSize);
if(_70.indexOf(",")!=-1){
this.dimPreview.width=parseInt(_70.split(",")[0]);
this.dimPreview.height=parseInt(_70.split(",")[1]);
if(_6e<document.getElementById("appcontent").boxObject.width/2){
this.dimPreview.left=(_6e+40)<200?200:_6e+40;
}else{
var _71=getBrowser().selectedTab.getAttribute("coolirispreviews_dispStack");
this.dimPreview.left=_6e-100-this.dimPreview.width;
if(this.dimPreview.left<0||(_71=="show")){
this.dimPreview.left=10;
}
}
if(this.dimPreview.width+this.dimPreview.left>document.getElementById("appcontent").boxObject.width){
this.dimPreview.width=document.getElementById("appcontent").boxObject.width-30-this.dimPreview.left;
}
if((this.dimPreview.left<_6e)&&(this.dimPreview.width+this.dimPreview.left>_6e)){
this.dimPreview.width=_6e-10-this.dimPreview.left;
}
if(this.dimPreview.height+30>document.getElementById("appcontent").boxObject.height){
this.dimPreview.height=document.getElementById("appcontent").boxObject.height-40;
}
}else{
if(_6e<document.getElementById("appcontent").boxObject.width/2){
this.dimPreview.left=(_6e+40)<200?200:_6e+40;
}else{
this.dimPreview.left=10;
}
if(_6e<document.getElementById("appcontent").boxObject.width/2){
this.dimPreview.width=document.getElementById("appcontent").boxObject.width-30-this.dimPreview.left;
}else{
this.dimPreview.width=_6e-40;
}
this.dimPreview.height=document.getElementById("appcontent").boxObject.height-30;
}
var _72=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewFixedLoc);
if(_72=="yes"){
var _73=cpvw_prefHandler.getPref(cpvw_Prefs.prefPreviewLoc);
if(_73.indexOf(",")!=-1){
this.dimPreview.left=parseInt(_73.split(",")[0]);
this.dimPreview.top=parseInt(_73.split(",")[1]);
if(this.dimPreview.top==0||this.dimPreview.top<0){
this.dimPreview.top=_6d;
}
}
if(_70.indexOf(",")!=-1){
this.dimPreview.width=parseInt(_70.split(",")[0]);
this.dimPreview.height=parseInt(_70.split(",")[1]);
}
}
this.dimPreview.mouseX=_6e;
this.dimPreview.mouseY=_6f;
if(cpvw_previewHandler.customSite=="youtube_video"){
var _74=cpvw_previewHandler.getPreviewFrame();
_74.markupDocumentViewer.fullZoom=1;
this.dimPreview.width=656;
this.dimPreview.height=470;
}
},hidePreview:function(_75){
if(this.hideTimer==null){
return;
}
try{
var _76=cpvw_previewHandler.hidePreview();
if(_76){
if(this.linkElem!=null){
this.linkElem.setAttribute("style","color:brown;");
}
this.isShowingPreview=false;
}
}
catch(ex){
}
},displayPreview:function(){
var _77=cpvw_objOverlay.getContentDocument();
if(_77==null||cpvw_docHandler==null){
return;
}
if(this.dispTimer==null){
return;
}
this.isShowingPreview=true;
cpvw_previewHandler.showPreview(this.dimPreview,cpvw_previewHandler.customSite);
cpvw_subSearchBar.showSearchBar();
if(this.linkElem!=null){
this.linkElem.style.color="orange";
}
},showImages:function(){
var _78=cpvw_previewHandler.getPreviewFrame();
var _79=_78.contentDocument.images;
for(var i=0;i<_79.length;i++){
_79[i].setAttribute("src",_79[i].src);
}
},previewOnLoad:function(evt){
var _7c=this;
var _7d=cpvw_previewHandler.getPreviewFrame();
cpvw_previewHandler.isLoaded=true;
if(cpvw_previewHandler.customSite=="google_video"){
googleVideo_filter(_7d.contentDocument);
}
var _7e=cpvw_prefHandler.getPrefJson(cpvw_Prefs.jsonPrefZoom);
conDump("zzzz oom tiype123 = "+_7e.zoomSetting);
if(_7e.zoomSetting=="browser"){
if(_7d.markupDocumentViewer!=null){
setTimeout(function(){
_7d.markupDocumentViewer.textZoom=cpvw_get("content").markupDocumentViewer.textZoom;
_7d.markupDocumentViewer.fullZoom=cpvw_get("content").markupDocumentViewer.fullZoom;
},100);
}
}else{
if(_7e.zoomSetting=="previews"){
if(_7e.zoomType=="text"){
_7d.markupDocumentViewer.textZoom=_7e.zoomTextSize;
}else{
if(_7e.zoomType=="full"){
_7d.markupDocumentViewer.fullZoom=_7e.zoomFullSize;
}
}
}else{
if(_7e.zoomSetting=="autofit"){
conDump("zzzz oom tiype = "+cpvw_previewHandler.dimPreview.width+", "+_7d.contentDocument.defaultView.scrollMaxX+" "+_7d.contentDocument.defaultView.pageXOffset+" "+((cpvw_previewHandler.dimPreview.width-40)/_7d.contentDocument.documentElement.scrollWidth));
if(_7d.contentDocument.defaultView.scrollMaxX>0){
_7d.markupDocumentViewer.fullZoom=(cpvw_previewHandler.dimPreview.width-50)/(cpvw_previewHandler.dimPreview.width+_7d.contentDocument.defaultView.scrollMaxX);
}
}
}
}
if(cpvw_previewHandler.customSite=="youtube_video"){
var _7d=cpvw_previewHandler.getPreviewFrame();
_7d.markupDocumentViewer.fullZoom=1;
}
this.doneHighlight=false;
},startPiclensLite:function(){
var doc=this.parentDoc;
if(doc.loadPiclensJS!=1){
doc.loadPiclensJS=1;
var _80=doc.createElement("script");
_80.setAttribute("type","text/javascript");
_80.setAttribute("src","http://lite.piclens.com/current/piclens.js");
var _81=doc.getElementsByTagName("head")[0];
if(_81!=null){
_81.appendChild(_80);
}else{
if(doc.body!=null){
doc.body.appendChild(_80);
}
}
}
var _82=cpvw_previewHandler.getPreviewFrame();
var _83=_82.contentDocument;
var _84=this.parWindow;
var _85=[];
var _86=_83.getElementsByTagName("IMG");
var _87=cpvw_prefHandler.getPref(cpvw_Prefs.prefPiclensFilterSize);
var _88=_87.split(",");
var _89=_88[0],_8a=_88[1];
for(var i=0;i<_86.length;i++){
var img=_86[i];
var _8d=img.src;
if(_8d==null){
continue;
}
var _8e=img.parentNode;
var m=0;
var _90=_8d;
while(_8e&&m<3){
if(_8e.nodeType==Node.ELEMENT_NODE){
if((_8e instanceof HTMLAnchorElement&&_8e.href)||_8e instanceof HTMLAreaElement||_8e instanceof HTMLLinkElement){
_90=_8e.href;
break;
}
}
_8e=_8e.parentNode;
m++;
}
if(_90!=_8d){
var uri=Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
uri.spec=_90;
var _92=Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService);
var _93;
try{
_93=_92.getTypeFromURI(uri);
}
catch(ex){
_93="";
}
if(_93.indexOf("image")==-1){
_90=_8d;
}
}
if(_90==_8d){
if(img.width<_89||img.height<_8a){
continue;
}
}
_85.push({"src":_90,"thumbnailSrc":_8d});
}
if(_85.length>0){
setTimeout(function(){
cpvw_jsUtils.showPiclensLite(_84,doc.title,doc.URL,_85,false);
},1000);
}else{
alert("No images to view (Images might be filtered according to your filter criteria)");
}
},highlightText:function(how){
var _95="";
var _96=cpvw_previewHandler.getPreviewFrame();
if(_96.contentDocument!=null&&_96.contentDocument.body!=null){
if(cpvw_previewHandler.customSite=="google_search"){
var _97=this.parentDoc.getElementsByTagName("input");
for(var i=0;i<_97.length;i++){
if(_97[i].getAttribute("name")=="q"){
_95=_97[i].value;
break;
}
}
}else{
if(cpvw_previewHandler.customSite=="yahoo_search"){
var _97=this.parentDoc.getElementsByTagName("input");
for(var i=0;i<_97.length;i++){
if(_97[i].getAttribute("name")=="p"){
_95=_97[i].value;
break;
}
}
}
}
if(_95==""){
return;
}
this.arrHighlightText=_95.split(" ");
if(this.arrHighlightText==null){
return;
}
if(how=="show"){
for(var i=0;i<this.arrHighlightText.length;i++){
this.highlightWord("#FFFF99","black",this.arrHighlightText[i],_96.contentWindow);
}
this.doneHighlight=true;
}else{
for(var i=0;i<this.arrHighlightText.length;i++){
this.removeHighlight(this.arrHighlightText[i],_96.contentWindow);
}
this.doneHighlight=false;
}
}
},removeHighlight:function(_99,win){
var _9b=false;
for(var i=0;win.frames&&i<win.frames.length;i++){
if(this.removeHighlight(aHighBackColor,aHighTextColor,_99,win.frames[i])){
_9b=true;
}
}
var doc=win.document;
if(!doc||!(doc instanceof HTMLDocument)){
return _9b;
}
var _9e=doc.body;
var _9f=_9e.childNodes.length;
this._searchRange=doc.createRange();
this._startPt=doc.createRange();
this._endPt=doc.createRange();
this._searchRange.setStart(_9e,0);
this._searchRange.setEnd(_9e,_9f);
this._startPt.setStart(_9e,0);
this._startPt.setEnd(_9e,0);
this._endPt.setStart(_9e,_9f);
this._endPt.setEnd(_9e,_9f);
var _a0=null;
var _a1=Components.classes["@mozilla.org/embedcomp/rangefind;1"].createInstance(Components.interfaces.nsIFind);
while((_a0=_a1.Find(_99,this._searchRange,this._startPt,this._endPt))){
var _a2=_a0.startContainer;
var _a3=null;
try{
_a3=_a2.parentNode;
}
catch(ex){
}
if(_a3&&_a3.className=="__cooliris-search"){
var _a4=null;
var _a5=doc.createDocumentFragment();
var _a6=_a3.nextSibling;
var _a7=_a3.parentNode;
while((_a4=_a3.firstChild)){
_a5.appendChild(_a4);
}
this._startPt=doc.createRange();
this._startPt.setStartAfter(_a3);
_a7.removeChild(_a3);
_a7.insertBefore(_a5,_a6);
_a7.normalize();
}else{
this._startPt=doc.createRange();
this._startPt.setStart(_a0.endContainer,_a0.endOffset);
}
this._startPt.collapse(true);
}
},highlightWord:function(_a8,_a9,_aa,win){
var _ac=false;
for(var i=0;win.frames&&i<win.frames.length;i++){
if(this.highlightWord(_a8,_a9,_aa,win.frames[i])){
_ac=true;
}
}
var doc=win.document;
if(!doc||!(doc instanceof HTMLDocument)){
return _ac;
}
var _af=doc.body;
var _b0=_af.childNodes.length;
this._searchRange=doc.createRange();
this._startPt=doc.createRange();
this._endPt=doc.createRange();
this._searchRange.setStart(_af,0);
this._searchRange.setEnd(_af,_b0);
this._startPt.setStart(_af,0);
this._startPt.setEnd(_af,0);
this._endPt.setStart(_af,_b0);
this._endPt.setEnd(_af,_b0);
var _b1=doc.createElementNS("http://www.w3.org/1999/xhtml","span");
_b1.style.backgroundColor=_a8;
_b1.style.color=_a9;
_b1.style.display="inline";
_b1.style.fontSize="inherit";
_b1.style.padding="0";
_b1.className="__cooliris-search";
return this.changeText(_aa,_b1)||_ac;
},changeText:function(_b2,_b3){
var _b4=null;
var _b5=Components.classes["@mozilla.org/embedcomp/rangefind;1"].createInstance().QueryInterface(Components.interfaces.nsIFind);
var _b6=false;
while((_b4=_b5.Find(_b2,this._searchRange,this._startPt,this._endPt))){
var _b7=_b3.cloneNode(true);
var _b8=this.highlight(_b4,_b7);
this._startPt=_b8.ownerDocument.createRange();
this._startPt.setStart(_b8,_b8.childNodes.length);
this._startPt.setEnd(_b8,_b8.childNodes.length);
_b6=true;
}
return _b6;
},highlight:function(_b9,_ba){
var _bb=_b9.startContainer;
var _bc=_b9.startOffset;
var _bd=_b9.endOffset;
var _be=_b9.extractContents();
var _bf=_bb.splitText(_bc);
var _c0=_bf.parentNode;
_ba.appendChild(_be);
_c0.insertBefore(_ba,_bf);
return _ba;
}};